<?php

/**
 * Index controller class
 *
 */

class IndexController extends Client_Controller
{
	public function init()
    {
        parent::init();
        $this->setActiveCat(62);
        $this->table_regions = new Client_Table_Regions($this->_lang);
    }

    public function indexAction()
    {
        $this->page_type = 'main';

        $this->_redirect('/auction');

    	$this->startContent();
	        $this->view->xmlWriter->startElement("Main");
	        $this->view->assign('reion-list', $this->table_regions->GetRegionsList());
		    $this->view->xmlWriter->endElement();
	    $this->view->xmlWriter->endElement();
    }

    public function staticAction()
    {
    	die('staticAction');
    	$page = $this->_getParam('page', 1);
    	$page_count = $this->_getParam('pager_count');

		if(is_null($page_count) && !isset($this->_sess->page_count)) $this->_sess->page_count = 10;
		elseif($page_count > 0) $this->_sess->page_count = $page_count;

    	$idt_arr = explode('/',$this->_getParam('id'));
    	$level = count($idt_arr);
		$this->page_type = 'level'.$level;
		$idt = $idt_arr[count($idt_arr)-1];

    	$cat = $this->table_categories->GetDataRow($idt);
    	if(!(isset($cat['id']) && @$cat['id'] > 0)) $this->_redirect('/error/e404');

    	$this->setActiveCat($cat['id']);

    	$this->startContent();
	        $this->view->xmlWriter->startElement("Main");
	       	//$this->view->assign('news', $this->table_articles->GetLast(array(), 5));
		    $this->view->xmlWriter->endElement();
	    $this->view->xmlWriter->endElement();
    }

    public function rssAction()
    {
        $this->table_articles->GetRSS();
    }

    public function GetCountList($a)
    {
		$data = array();
    	for($i = 10, $k = 0; $i <= 50; $i += 10, $k++)
		{
    		$data[$k] = array('id' => $k, 'val' => $i);
    		if($a == $i) $data[$k]['__attributes']['active'] = 1;
		}

		return $data;
    }

}
